From: Ignacy KuchciƄski Date: Sat, 22 Nov 2025 00:45:32 +0000 (+0100) Subject: timeLimitsManager: Factor out wellbeing-daily-limit-enabled X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~44^2~36 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=86605518b529bb62b717961cbf9cb2b9153d1b6d;p=gnome-shell.git timeLimitsManager: Factor out wellbeing-daily-limit-enabled Factor out wellbeing-daily-limit-enabled specific for the wellbeing screen time limits functionality to a separate function, which will make it easier in the future to make the daily-limit-enabled property also handle parental controls session limits functionality. Part-of: --- diff --git a/js/misc/timeLimitsManager.js b/js/misc/timeLimitsManager.js index e1a22f0f8..2793687dc 100644 --- a/js/misc/timeLimitsManager.js +++ b/js/misc/timeLimitsManager.js @@ -876,7 +876,7 @@ export const TimeLimitsManager = GObject.registerClass({ * @returns {number} */ _calculateDailyLimitReachedAtSecs(nowSecs, dailyLimitSecs, startOfTodaySecs) { - console.assert(this.dailyLimitEnabled, + console.assert(this.wellbeingDailyLimitEnabled, 'Daily limit reached-at time only makes sense if limits are enabled'); // NOTE: This might return -1. @@ -1045,6 +1045,15 @@ export const TimeLimitsManager = GObject.registerClass({ return this._parentalControlsManager.sessionLimitsEnabled(); } + /** + * Whether the wellbeing daily limit is enabled. + * + * @type {boolean} + */ + get wellbeingDailyLimitEnabled() { + return this._screenTimeLimitSettings.get_boolean('daily-limit-enabled'); + } + /** * The time when the daily limit will be reached. If the user is currently * active, and has not reached the limit, this is a non-zero value in the @@ -1060,7 +1069,7 @@ export const TimeLimitsManager = GObject.registerClass({ case TimeLimitsState.DISABLED: return 0; case TimeLimitsState.ACTIVE: { - if (!this.dailyLimitEnabled) + if (!this.wellbeingDailyLimitEnabled) return 0; const nowSecs = this.getCurrentTime(); @@ -1098,7 +1107,7 @@ export const TimeLimitsManager = GObject.registerClass({ * @type {boolean} */ get dailyLimitEnabled() { - return this._screenTimeLimitSettings.get_boolean('daily-limit-enabled'); + return this.wellbeingDailyLimitEnabled; } /**